{if $full_page}
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{$title}</title>
<link rel="stylesheet" href="Res/boot/css/bootstrap.min.css" type="text/css" media="screen" />
<link rel="stylesheet" href="Res/boot/css/bootstrap-theme.min.css" type="text/css" media="screen" />
<script type="text/javascript" src="Res/js/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="Res/js/jquery.cookie.js"></script>
<script type="text/javascript" src="Res/boot/js/bootstrap.min.js"></script>
<script type="text/javascript" src="Res/js/listTable.js"></script>
<link rel="stylesheet" href="Res/css/page.css" type="text/css" />
<link rel="stylesheet" href="Res/css/global.css" type="text/css" />
<script type="text/javascript" src="Res/js_time/laydate.js"></script>
{literal}
<style>
    .listDiv{margin:0 auto;}  
    table tbody td lable:hover{background-color:#00E8D7}
</style>
{/literal}
</head>
<body>
<div class="container-fluid">
	<div class="row-fluid">
            <div class="span12 panel panel-info">                
                <span class="cp_title">订单管理</span>
                <div class="panel-heading">
                    <div class="form-inline">
                        {if $isadmin eq true}
                        <div class="form-group">
                          <label class="" for="user_name">用户名称:</label>
                          <input type="email" class="form-control" id="user_name" placeholder="用户名称">
                        </div>
                        {/if}
                        <div class="form-group">
                          <label class="" for="start_time">开始时间:</label>
                          <input type="email" class="form-control" id="start_time" placeholder="开始时间">
                        </div>
                        <div class="form-group">
                          <label class="" for="end_time">结束时间:</label>
                          <input type="email" class="form-control" id="end_time" placeholder="结束时间">
                        </div>
                        <div class="form-group">
                          <label class="" for="to_time">选择某一天</label>
                          <select class="form-control" id="to_time">
                              <option value="0">选择</option>
                              <option value="1">今天</option>
                              <option value="2">昨天</option>
                              <option value="3">近3天</option>
                              <option value="4">近7天</option>            
                              <option value="5">近30天</option>
                              <option value="6">本月</option>
                              <option value="7">上月</option>
                              <option value="8">上三月</option>
                              <option value="9">上半年</option>
                              <option value="10">本年</option>
                              <option value="11">去年</option>
                          </select>
                        </div>
                        {if $isadmin eq true}
                        <div class="form-group">
                            <label class="sr-only" for="end_time">选择模式:</label>
                            <select class="form-control" id="model" name="model">
                            <option value="0">选择模式</option>
                            <option value="1">读取隐藏数据</option>
                            <option value="2">读取已删除数据</option>
                            <option value="3">读取所有数据</option>
                            </select>
                        </div>
                        {/if}
                        <div class="checkbox">
                          <label>
                              <input type="checkbox" id="is_show"> 读取隐藏数据
                          </label>
                        </div>
                        <button type="button" id="btn_search" class="btn btn-success">查找</button>    
                    </div>
                </div>
 
                <div class="listDiv" id="listDiv">
{/if}
                <table id="data_table_id" class="table table-hover table-bordered text-center">
                    <thead>
                    <tr>                        
                        <th>ID</th>
                        <th>游戏名称</th>
                        <th>内容</th>
                        <th>显示状态</th>
                        {if $isadmin eq true}
                        <th>用户名</th>   
                        <th>删除状态</th>
                        {/if}                        
                        <th><a href="javascript:listTable.sort('in_time', 'DESC');" title="点击对列表排序">时间</a>{$sort_in_time}</th>                        
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>    
                        {foreach from=$data.pageData item=row}
                        <tr>
                            <td>{$row.id}</td>
                            <td>{$row.game_name}</td>
                            <td style="width:30%;text-align: left;">
                                {if $row.content}
                                <table class="table table-striped">                              
                                {foreach from=$row.content item=val key=key}                                    
                                    <tr>
                                    <td>{$key}</td>   
                                    <td>{$val}</td>   
                                    </tr>
                                {/foreach}
                                </table>
                                {/if}
                            </td>
                            <td>
                                <span class="glyphicon {$row.is_show}" style="cursor:pointer;font-size: 16px;line-height: 28px;" onclick="listTable.toggle(this, {$row.order_id}, 'is_show')"></span>
                            </td>
                            {if $isadmin eq true}
                            <td>{$row.user_name}</td> 
                            <td>
                                <span class="glyphicon {$row.is_del}" style="cursor:pointer;font-size: 16px;line-height: 28px;" onclick="listTable.toggle(this, {$row.order_id}, 'is_del')"></span>
                            </td>
                            {/if}                            
                            <td>{$row.in_time_format}</td>                            
                            <td style="text-align:center;">          
                                <button class="btn btn-info" type="button" onclick="del({$row.order_id})">
                                    <span class="glyphicon glyphicon-trash"></span>
                                </button>
                                {if $isadmin eq true}
                                <button class="btn btn-info" type="button" onclick="listTable.remove({$row.order_id})">
                                    <span class="glyphicon glyphicon-remove-circle"></span>
                                </button>
                                {/if}
                            </td>
                        </tr>
                        {/foreach}
                    </tbody>
                    <tfoot>
                        <!-- 分页数据 -->
                        <tr>
                            <td colspan="8"><div class="iPageHtml">{$data.pageHtml}</div></td>
                        </tr>
                    </tfoot>
                </table>
              
{if $full_page}
                </div>
            </div>
	</div>
</div>
<div style="clear:both;"></div>
<script type="text/javascript">
    listTable.m = 'query';
    listTable.divid = 'listDiv';
    $("#btn_search").click(function(){
        listTable.filter['page'] =1;
        listTable.filter['user_name'] = $("#user_name").val();
        listTable.filter['start_time'] = $("#start_time").val();
        listTable.filter['end_time'] = $("#end_time").val();
        listTable.filter['model'] = $("#model").val();
        var is_show = $("#is_show").is(":checked") === true ? 1 : 0;
        listTable.filter['is_show'] = is_show;
        listTable.filter['to_time'] = $("#to_time").val();
        listTable.loadList();
    });
    function del(id){
        if(!confirm("真的删除吗")) {
            return;
        }
        var url = 'index.php?c=order&m=del';   
        var params = new Object();
        params.id = id;        
        params.ajax = 1;
        $.post(url, params, function(data){
            if(data.status == 0) {
                listTable.loadList();
            } else {
                alert(data.msg);
            }
        }, 'json');
    }
    
var start = {
    elem: '#start_time',
    format: 'YYYY-MM-DD hh:mm:ss',
    min: laydate.now(), //设定最小日期为当前日期
    max: '2099-06-16 23:59:59', //最大日期
    istime: true,
    istoday: false,
    festival: true, //是否显示节日
    choose: function(datas){
         end.min = datas; //开始日选好后，重置结束日的最小日期
         end.start = datas; //将结束日的初始值设定为开始日
    }
};
var end = {
    elem: '#end_time',
    format: 'YYYY-MM-DD hh:mm:ss',
    min: laydate.now(),
    max: '2099-06-16 23:59:59',
    istime: true,
    istoday: false,
    festival: true, //是否显示节日
    choose: function(datas){
        start.max = datas; //结束日选好后，重置开始日的最大日期
    }
};
laydate(start);
laydate(end);
laydate.skin("yalan");
</script>
</body>
</html>
{/if}
